﻿<UserControl x:Class="XWord.GUI.UserControls.SearchBar"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:info="http://schemas.xword.com/winfx/xaml/info"
             xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
			 xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"
			 xmlns:aerotheme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
             xmlns:cal="http://www.caliburnproject.org"
             mc:Ignorable="d"  >
<UserControl.Resources>
    
	    <Style TargetType="CheckBox" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.CheckBoxKey}}" />
        <Style TargetType="ComboBox" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.ComboBoxKey}}" />
		<Style TargetType="Button" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.ButtonKey}}" />
</UserControl.Resources>
        <Border BorderThickness="1" Margin="2" BorderBrush="{DynamicResource {x:Static themes:RibbonCommonDictionary.EditControlBorderNormalBrushKey}}">
            <Grid>
               
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition MinWidth="100" Width="100*" />
                    <ColumnDefinition Width="15" />
					<ColumnDefinition Width="15" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="22"/>
				</Grid.RowDefinitions>
            <ComboBox SelectedIndex="{Binding SearchMode}" BorderThickness="0,0,1,0" x:Name="Element_SearchMode">
                    <ComboBoxItem>词根</ComboBoxItem>
                    <ComboBoxItem>单词</ComboBoxItem>
                </ComboBox>
            <info:SearchComboBox Grid.Column="1" BorderThickness="0" x:Name="Element_SearchComboBox"
                 KeyDown="Element_SearchComboBox_KeyDown"
                
                 Text="{Binding SearchText,UpdateSourceTrigger=PropertyChanged}"
				 Style="{StaticResource {x:Static ribbon:RibbonStyles.ComboBoxKey}}"
				 ItemsSource="{Binding LatestSearchList,Source={x:Static info:XWordAppConfig.Current}}"
                         cal:Message.Attach="[Event TextChanged] = [Action SearchEtyma($this.Text)]">
                	<info:SearchComboBox.Resources>
                		<Style TargetType="{x:Type TextBox}">
                			<Setter Property="BorderThickness" Value="0"/>   
						</Style>         	
					</info:SearchComboBox.Resources>         
						 </info:SearchComboBox>
            <Button x:Name="Element_MovePrevious" Click="Element_MovePrevious_Click" Grid.Column="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
				  BorderBrush="{DynamicResource {x:Static themes:RibbonCommonDictionary.EditControlBorderNormalBrushKey}}"
				 Margin="-1,0,0,0" BorderThickness="1,0,1,0"
				 Background="{DynamicResource {x:Static themes:RibbonCommonDictionary.EditControlBackgroundNormalBrushKey}}">
				<Path Data="F0 M 0,0 L 2.5,3 5,0 Z"
				 RenderTransformOrigin="0.5,0.5"
				 Fill="{DynamicResource {x:Static themes:RibbonCommonDictionary.RibbonControlDropDownArrowBrushKey}}">
					<Path.RenderTransform>
             			<TransformGroup>
             				<ScaleTransform/>
             				<SkewTransform/>
             				<RotateTransform Angle="90"/>
             				<TranslateTransform/>
             			</TransformGroup>
             		</Path.RenderTransform>
				</Path>	
				</Button>
					<Button x:Name="Element_MoveNext" Click="Element_MoveNext_Click" Grid.Column="3" BorderBrush="{DynamicResource {x:Static themes:RibbonCommonDictionary.EditControlBorderNormalBrushKey}}"
					 BorderThickness="0"
				    Background="{DynamicResource {x:Static themes:RibbonCommonDictionary.EditControlBackgroundNormalBrushKey}}"
					HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
						<Path Data="F0 M 0,0 L 2.5,3 5,0 Z" 
						RenderTransformOrigin="0.5,0.5"
						Fill="{DynamicResource {x:Static themes:RibbonCommonDictionary.RibbonControlDropDownArrowBrushKey}}">
							<Path.RenderTransform>
             			<TransformGroup>
             				<ScaleTransform/>
             				<SkewTransform/>
             				<RotateTransform Angle="-90"/>
             				<TranslateTransform/>
             			</TransformGroup>
             		</Path.RenderTransform>
						</Path></Button>
            <ribbon:SplitButton Grid.Column="4" Label="{Binding Tag.Name,RelativeSource={RelativeSource Mode=Self}}" x:Name="Element_SplitButton">
                <ribbon:Menu x:Name="Element_WebEngine">
                    <ribbon:Menu.ItemTemplate>
                        <DataTemplate>
                            <ribbon:Button Click="WebEngineChanged" Label="{Binding Name}"/>
                        </DataTemplate>
                    </ribbon:Menu.ItemTemplate>
                </ribbon:Menu>
            </ribbon:SplitButton>
             
        </Grid>
        </Border>
</UserControl>
